﻿
@{
    Layout = "";
    ViewBag.MenuId = 3;
}
<!-- 列表总div -->
<div class="flayout_e_content f_mb60" ng-controller="GroupOrderListController">

    <div ng-show="reddit.items.length>0" infinite-scroll='reddit.nextPage()' infinite-scroll-disabled='reddit.busy' infinite-scroll-distance='0'>
        <!-- 已支付 -->
        <div class="flayout_e_eachBox flayout_e_success" ng-repeat="model in reddit.items">
            <div class="flayout_e_eachRow">
                <p class="flayout_e_dp">
                    <img src="/Content/images/f_40.png" alt="店铺图标">
                    <span>优品三悦</span>
                </p>
                <p class="flayout_e_orderState">
                    {{model.StatusDes}}
                </p>
            </div>
            <div class="flayout_e_orderPorbox">
                <a href="javascript:void(0)" ng-click="goorder(model.Id)">
                    <div class="flayout_e_orderPorimg">
                        <img src="{{ImgHostUrl+model.OrderDetailList[0].ImgUrl}}" alt="产品图">
                    </div>
                    <div class="flayout_e_orderPorInfo">
                        <p class="flayout_e_orderPorName">{{model.OrderDetailList[0].ProductName}}</p>
                        <p class="flayout_e_orderPorPrice">实付款：¥{{model.ProductPrice}}</p>
                        <img src="/Content/images/f_42.png" alt="拼团成功" class="state_img success_img">
                        <img src="/Content/images/f_42a.png" alt="拼团失败" class="state_img fail_img">
                        <img src="/Content/images/f_43.png" alt="已中奖" class="state_img winning_img">
                        <img src="/Content/images/f_44.png" alt="未中奖" class="state_img no_winning_img">
                        <img src="/Content/images/f_45.png" alt="拼团进行中" class="state_img in_collage_img">
                    </div>
                </a>
            </div>
            <div class="flayout_f_orderBtns" ng-show="model.SendStatus==1&&model.OrderState==1">
                <input type="submit" value="确认收货" ng-click="confirmOrder(model.Id,model)" class="f_orderBtn">
            </div>
        </div>
        <!--end 已支付 -->
    </div>
</div>
<!--end 列表总div -->
<!-- 底部 -->
@Html.Partial("_dgfoot")
<!--end 底部 -->
<!--end 列表总div -->
<script>
    App.controller('GroupOrderListController', [
           '$scope', '$http', '$rootScope', 'Reddit', '$stateParams', '$state',
       function ($scope, $http, $rootScope, Reddit, $stateParams, $state) {


           $scope.reddit = new Reddit("/DropGroup/GetGroupOrderList", { Take: 5, dropgroupid: $stateParams.Id }, function (response) {
               debugger;
           });


           var tt = function () {
               $rootScope.WxShare($rootScope.pageTitle(), '优品三悦', location.href, $rootScope.LogoUrl);
           }

           setTimeout(tt, 1000)

           $scope.goorder = function (id) {
               $state.go('shop.orderdetail', { id: id });
           }

           $scope.confirmOrder = function (id, model) {


               layer.confirm('确认收货吗？', {
                   btn: ['确定', '取消'] //按钮
               }, function () {
                   layer.load(2);
                   $http.post("/Order/ConfirmOrder", { id: id }).then(function (response) {
                       layer.closeAll('loading');
                       if (response.data.isSuccess) {
                           layer.msg("操作成功");
                           model.OrderState = 2;
                           model.OrderStatusDes = "已收货";
                       }
                       else {
                           layer.msg(response.data.msg);
                       }

                   });
               }, function () {

               });
           }

       }]);
</script>